import Vue from 'vue'
import Router from 'vue-router'
import Home from '@/pages/home/Home'
import Store from '@/pages/store/Store'
import StoreGoods from '@/pages/store/components/goods/Goods'
import StoreRatings from '@/pages/store/components/ratings/Ratings'
import StoreSeller from '@/pages/store/components/seller/Seller'
import FoodDetail from '@/pages/detail/FoodDetail'

Vue.use(Router)

export default new Router({
  routes: [
    {
      path: '/',
      name: 'Home',
      component: Home
    }, {
      path: '/store/:sellerId',
      component: Store,
      children: [{
        path: '/',
        name: 'Order',
        component: StoreGoods
      }, {
        path: 'ratings',
        name: 'Ratings',
        component: StoreRatings
      }, {
        path: 'seller',
        name: 'Seller',
        component: StoreSeller
      }]
    }, {
      path: '/detail',
      name: 'FoodDetail',
      component: FoodDetail
    }
  ],
  scrollBehavior (to, from, savedPosition) {
    return { x: 0, y: 0 }
  }
})
